home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / T-Z / XrefTextPack.cpt / XrefText_M / stack.txt < prev   
Text File  |  1989-02-26  |  11KB  |  325 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2583
  12. -- card count: 13
  13. -- first card id: 4144
  14. -- list block id: 3862
  15. -- print block id: 3442
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 41120 bytes
  21. -- stack block size: 8704 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x00000000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. on openstack
  69.   go to card Index
  70.   global prioruserlevel
  71.   get the userLevel
  72.   put it into prioruserlevel
  73.   set the userLevel to 5
  74.   -- create the menus
  75.   --  keep the "handles" to the menus in these globals
  76.   global menu1
  77.   put NewMenu("XrefText/M","Go To Reference","Create Reference", "(-","Back Up","Back To Index","(-","New XrefText Stack", "Toggle Picture","Import Text","Output","(-","XrefText-M Help")into menu1
  78.   if menu1 is 0 then answer("Unable to make menu 'BEEP'") with "Drat"
  79. end openstack
  80.  
  81. on closestack
  82.   global prioruserlevel
  83.   set the userLevel to prioruserlevel
  84.   set the loc of msg to 22,300
  85.   --  delete the menus we've created using
  86.   --the globals saved in openStack
  87.   global menu1
  88.   put DeleteMenu(menu1) into menu1
  89.   --  clearing global for safety
  90. end closestack
  91.  
  92. on doMenu which
  93.   --  get our menu items from doMenu before HyperCard does...
  94.   global menu1, menu2
  95.   -- for CheckMenu and EnableMenu below
  96.   if which is "Go To Reference" then
  97.     put the selection into holder
  98.     push card
  99.     visual effect wipe right to black
  100.     visual effect wipe left
  101.     find holder in field keywords
  102.     if the result is not empty then
  103.       answer "No match for keyword " "e& holder"e
  104.       pop card
  105.     end if
  106.   else if which is "Create Reference" then
  107.     put the selection into holder
  108.     type ">" & holder & "<"
  109.     push card
  110.     find holder in field keywords
  111.     if the result is not empty then
  112.       doMenu New Card
  113.       put holder into field keywords
  114.       set the name of this card to holder
  115.       get the number of lines in card field finder of card theIndex
  116.       put holder into line it+1 of card field finder of card theIndex
  117.     else
  118.       put the length of holder into hl
  119.       put the length of word 1 of field keywords into kl
  120.       if hl<>kl then
  121.         answer "Close match but not exact!" with "Good Enough" or "New Card"
  122.         if it contains "New" then
  123.           set lockscreen to true
  124.           go prev
  125.           doMenu New Card
  126.           put holder into field keywords
  127.           set the name of this card to holder
  128.           get the number of lines in card field finder of card theIndex
  129.           put holder into line it+1 of card field finder of card theIndex
  130.           set lockscreen to false
  131.         end if
  132.       end if
  133.     end if
  134.   else if which is "Back Up" then
  135.     if the number of this card = 1 then
  136.       answer "Careful. You might leave this stack." with Cancel or OK
  137.       if it = "OK" then
  138.         visual effect wipe left to black
  139.         visual effect wipe right
  140.         go back
  141.       else
  142.         exit doMenu
  143.       end if
  144.     else
  145.       visual effect wipe left to black
  146.       visual effect wipe right
  147.       pop card
  148.     end if
  149.   else if which is "Back To Index" then
  150.     if the number of this card > 1 then
  151.       -- visual effect wipe down to black
  152.       visual effect iris close to white
  153.       visual effect dissolve
  154.       go to first card
  155.     else
  156.       play boing
  157.       answer "You're already at the first card!"
  158.     end if
  159.   else if which is "XrefText-M Help" then
  160.     visual effect dissolve
  161.     go card ayuda
  162.   else if which is "Toggle Picture" then
  163.     if the number of this card > 2 then
  164.       answer "Change to Picture or Text?" with Text or Picture
  165.       if it contains "Text" then
  166.         show tool window
  167.         choose select tool
  168.         doMenu Select All
  169.         doMenu Clear Picture
  170.         choose browse tool
  171.         hide tool window
  172.         hide pattern window
  173.       else
  174.         show pattern window
  175.         show tool window
  176.         choose rectangle tool
  177.         set filled to false
  178.         drag from (item 1 of the rect of field keywords), (item 2 of the rect of field keywords) to (item 3 of the rect of field keywords), (item 4 of the rect of field keywords)
  179.         drag from 0,28 to 512,342
  180.         choose bucket tool
  181.         set pattern to 1
  182.         click at 250,250
  183.         choose text tool
  184.         set the textfont to Geneva
  185.         set the textsize to 9
  186.         click at 10,320
  187.         type "Don't use eraser. Use white brush instead."
  188.         click at 10,330
  189.         type "Choosing Browse Tool will show XrefText/M menu."
  190.         choose brush tool
  191.       end if
  192.     else
  193.       play boing
  194.       answer "Uh-uh. You don't want to change this card."
  195.     end if
  196.   else if which is "Import Text" then
  197.     if the number of this card > 2 then
  198.       if field body is empty then
  199.         put FileName("TEXT") into theFile
  200.         if theFile is not empty then
  201.           open file theFile
  202.           read from file theFile for 16000
  203.           put it into bkgnd field body
  204.           close file theFile
  205.         end if
  206.       else
  207.         answer "Import Text: Replace or Add to field contents?" with "Replace" or "Add" or "Cancel"
  208.         if it = "Cancel" then exit mouseup
  209.         if it = "Replace" then
  210.           put FileName("TEXT") into theFile
  211.           if theFile is not empty then
  212.             open file theFile
  213.             read from file theFile for 16000
  214.             put it into bkgnd field body
  215.             close file theFile
  216.           end if
  217.         else
  218.           put return after last line of bkgnd field body
  219.           put FileName("TEXT") into theFile
  220.           if theFile is not empty then
  221.             open file theFile
  222.             read from file theFile for 16000
  223.             put the number of lines in field body into liner
  224.             put it after line liner of bkgnd field body
  225.             close file theFile
  226.           end if
  227.         end if
  228.       end if
  229.     else
  230.       play boing
  231.       Answer "Don't import to Index or Help Card!"
  232.     end if
  233.   else if which is "Output" then
  234.     answer "Output to printer or to text file?" with "Printer" or "File" or "Cancel"
  235.     if it = "Cancel" then
  236.       exit doMenu
  237.     else if it = "Printer" then
  238.       answer "Print the stack or a report of its text" with "Stack" or "Report" or "Cancel"
  239.       if it = "Cancel" then
  240.         exit doMenu
  241.       else if it = "Stack" then
  242.         doMenu Print Stack...
  243.       else if it = "Report" then
  244.         doMenu Print Report...
  245.       end if
  246.     else if it = "File" then
  247.       answer "Save a file of the Stack or of this Card?" with "Stack" or "Card" or "Cancel"
  248.       if it = "Cancel" then
  249.         exit mouseup
  250.       else if it = "Stack" then
  251.         put the number of cards into counter
  252.         go to first card
  253.         put the short name of this stack & ".text" into tfilename
  254.         Get PutFile("Save text as:",tfilename)
  255.         if it is empty then exit doMenu
  256.         put it into textfile
  257.         set cursor to 4
  258.         set the loc of message to 10,120
  259.         put "Writing to file " & textfile & ".  Please wait..."into message
  260.         open file textfile
  261.         repeat (counter - 1)
  262.           go next card
  263.           write field keywords to file textfile
  264.           write return to file textfile
  265.           write field body to file textfile
  266.           write return to file textfile
  267.           write return to file textfile
  268.         end repeat
  269.         close file textfile
  270.         go first card
  271.         play harpsichord c e g bb
  272.         flash 1
  273.         put "Done." into message
  274.         wait 2 seconds
  275.         hide message
  276.       else if it = "Card" then
  277.         put the short name of this card & ".text" into tfilename
  278.         Get PutFile("Save text as:",tfilename)
  279.         if it is empty then exit doMenu
  280.         put it into textfile
  281.         open file textfile
  282.         write field keywords to file textfile
  283.         write return to file textfile
  284.         write field body to file textfile
  285.         close file textfile
  286.       end if
  287.     end if
  288.   else if which is "New XrefText Stack" then
  289.     put the short name of this stack into checker
  290.     doMenu New Stack...
  291.     get the short name of this stack
  292.     if it = checker then exit doMenu
  293.     put it into field "keywords"
  294.     push card
  295.     go back
  296.     ---
  297.     go to second card
  298.     doMenu "Copy Card"
  299.     pop card
  300.     doMenu "Paste Card"
  301.     push card
  302.     ---
  303.     go to first card of stack checker
  304.     doMenu "Copy Card"
  305.     pop card
  306.     go prev
  307.     doMenu "Paste Card"
  308.     click at the loc of button "Re-Index"
  309.   else pass doMenu
  310.   --  Remember to pass on menu commands you don't trap!
  311. end doMenu
  312.  
  313. on idle
  314.   --  call ShowMenu every so often just in case our menus vanished
  315.   global menu1, lastTick
  316.   if (the ticks-lastTick)>120 then
  317.     --  gives better performance than on every iteration
  318.     put the ticks into lastTick
  319.     ShowMenu(menu1)
  320.   end if
  321.   pass idle
  322. end idle
  323.  
  324.  
  325.